﻿using Production_Data_to_Sldmp.ppdEntity;
using Production_Data_to_Sldmp.sldmpEntity;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Production_Data_to_Sldmp
{
    internal class EntityConvertUtil
    {
        /// <summary>
        /// 将老的部门考勤表转换为新的部门考勤表
        /// </summary>
        internal static List<Ppd_attendanceInfo> ConvertAttendanceInfoEntity(List<Pos_AttendanceInfo> list)
        {
            List<Ppd_attendanceInfo> result = new List<Ppd_attendanceInfo>();
            if (list.Count == 0) { return result; }
            // 遍历老的部门考勤表
            foreach (var it in list)
            {
                Ppd_attendanceInfo nIt = new Ppd_attendanceInfo
                {
                    Id = Convert.ToInt64(it.Id),
                    Year = it.Year,
                    Month = it.Month,
                    Day = it.Day,
                    Department = it.Department,
                    Morning_arrive = it.Zb_yd,
                    Morning_actual = it.Zb_sd,
                    Morning_absent = it.Zb_qq,
                    Day_arrive = it.Bb_yd,
                    Day_actual = it.Bb_sd,
                    Day_absent = it.Bb_qq,
                    Night_arrive = it.Wb_yd,
                    Night_actual = it.Wb_sd,
                    Night_absent = it.Wb_qq,
                    Total_arrive = it.Yd_sum,
                    Total_actual = it.Sd_sum,
                    Total_absent = it.Qq_sum,
                    //Attendance_rate = (decimal)it.Cql,
                    Is_used = it.IsUsed,
                };
                if (it.Cql.HasValue) nIt.Attendance_rate = (int)it.Cql;
                result.Add(nIt);
            }
            return result;
        }

        /// <summary>
        /// 将老辅助能源消耗表转换为新辅助能源消耗表
        /// </summary>
        internal static List<Ppd_auxiliary_ecInfo> ConvertAuxiliaryECInfoEntity(List<Pos_AuxiliaryECInfo> list)
        {
            List<Ppd_auxiliary_ecInfo> result = new List<Ppd_auxiliary_ecInfo>();
            if (list.Count == 0) { return result; }
            // 遍历老辅助能源消耗表
            foreach (var it in list)
            {
                Ppd_auxiliary_ecInfo nIt = new Ppd_auxiliary_ecInfo
                {
                    Id = Convert.ToInt64(it.Id),
                    Year = it.Year,
                    Month = it.Month,
                    Day = it.Day,
                    //Pump_station_water = (decimal)it.Gys_jybz,
                    //Wang_ming_water = (decimal)it.Gys_wm,
                    //Qing_feng_water = (decimal)it.Gys_qf,
                    //Production_area_water = (decimal)it.Gys_glf,
                    //Air_compressor_station_water = (decimal)it.Gys_kyz,
                    //Casting_water = (decimal)it.Gys_zz,
                    //Anode_water = (decimal)it.Gys_jybz,
                    //Dormitory_and_bathroom_water = (decimal)it.Gys_ssys,
                    //Natural_gas = (decimal)it.Trq_qc,
                    //Pressure_regulating_station_gas = (decimal)it.Trq_tyz,
                    //Anode_gas = (decimal)it.Trq_yj,
                    //Qing_feng_gas = (decimal)it.Trq_qf,
                    //Front_area_gas = (decimal)it.Trq_cqq,
                    //Canteen_gas = (decimal)it.Trq_st,
                    Is_used = it.IsUsed,
                };
                if (it.Gys_jybz.HasValue) nIt.Pump_station_water = (decimal)it.Gys_jybz;
                if (it.Gys_wm.HasValue) nIt.Wang_ming_water = (decimal)it.Gys_wm;
                if (it.Gys_qf.HasValue) nIt.Qing_feng_water = (decimal)it.Gys_qf;
                if (it.Gys_glf.HasValue) nIt.Production_area_water = (decimal)it.Gys_glf;
                if (it.Gys_kyz.HasValue) nIt.Air_compressor_station_water = (decimal)it.Gys_kyz;
                if (it.Gys_zz.HasValue) nIt.Casting_water = (decimal)it.Gys_zz;
                if (it.Gys_yj.HasValue) nIt.Anode_water = (decimal)it.Gys_yj;
                if (it.Gys_ssys.HasValue) nIt.Dormitory_and_bathroom_water = (decimal)it.Gys_ssys;
                if (it.Gys_jybz.HasValue) nIt.Pump_station_water = (decimal)it.Gys_jybz;
                if (it.Trq_qc.HasValue) nIt.Natural_gas = (decimal)it.Trq_qc;
                if (it.Trq_tyz.HasValue) nIt.Pressure_regulating_station_gas = (decimal)it.Trq_tyz;
                if (it.Trq_zz.HasValue) nIt.Casting_gas = (decimal)it.Trq_zz;
                if (it.Trq_yj.HasValue) nIt.Anode_gas = (decimal)it.Trq_yj;
                if (it.Trq_qf.HasValue) nIt.Qing_feng_gas = (decimal)it.Trq_qf;
                if (it.Trq_cqq.HasValue) nIt.Front_area_gas = (decimal)it.Trq_cqq;
                if (it.Trq_st.HasValue) nIt.Canteen_gas = (decimal)it.Trq_st;
                result.Add(nIt);
            }
            return result;
        }

        /// <summary>
        /// 将老考勤部门表转换为新考勤部门表
        /// </summary>
        internal static List<Ppd_base_attend_deptInfo> ConvertBaseAttendDeptInfoEntity(List<Pos_BaseAttendDeptInfo> list)
        {
            List<Ppd_base_attend_deptInfo> result = new List<Ppd_base_attend_deptInfo>();
            if (list.Count == 0) { return result; }
            // 遍历老考勤部门表
            foreach (var it in list)
            {
                Ppd_base_attend_deptInfo nIt = new Ppd_base_attend_deptInfo
                {
                    //Id = Convert.ToInt32(it.Id),
                    Department = it.Department,
                    Is_enable = it.IsEnable,
                };
                result.Add(nIt);
            }
            return result;
        }

        /// <summary>
        /// 将老主要设备表转换为新主要设备表
        /// </summary>
        internal static List<Ppd_base_main_eqInfo> ConvertBaseMainEqInfoEntity(List<Pos_BaseMainEQInfo> list)
        {
            List<Ppd_base_main_eqInfo> result = new List<Ppd_base_main_eqInfo>();
            if (list.Count == 0) { return result; }
            // 遍历老主要设备表
            foreach (var it in list)
            {
                Ppd_base_main_eqInfo nIt = new Ppd_base_main_eqInfo
                {
                    //Id = Convert.ToInt64(it.Id),
                    System_name = it.SystemName,
                    Eq_name = it.EquipmentName,
                    Unit = it.Unit,
                    Is_enable = it.IsEnable,
                };
                result.Add(nIt);
            }
            return result;
        }

        /// <summary>
        /// 将老铸造铝产量表转换为新铸造铝产量表
        /// </summary>
        internal static List<Ppd_casting_productionInfo> ConvertCastingProductionInfoEntity(List<Pos_CastingProductionInfo> list)
        {
            List<Ppd_casting_productionInfo> result = new List<Ppd_casting_productionInfo>();
            if (list.Count == 0) { return result; }
            // 遍历老铸造铝产量表
            foreach (var it in list)
            {
                Ppd_casting_productionInfo nIt = new Ppd_casting_productionInfo
                {
                    Id = Convert.ToInt64(it.Id),
                    Year = it.Year,
                    Month = it.Month,
                    Day = it.Day,
                    //Liquid_aluminium = (decimal)it.Ly_dj,
                    //Export_aluminium = (decimal)it.Ly_wx,
                    //Casting_aluminium = (decimal)it.Ly_zz,
                    //Casting_aluminium_product = (int)it.Cp_zz,
                    //Directional_aluminium_product = (int)it.Cp_dx,
                    //Aluminium_product_out = (int)it.Cp_ck,
                    //Aluminium_product_stock = (int)it.Cp_kc,
                    //Alloy_silicon = (decimal)it.Hj_gi,
                    //Alloy_silicon_out = (decimal)it.Hj_gi_ck,
                    //Alloy_silicon_stock = (decimal)it.Hj_gi_kc,
                    //Alloy_manganese = (decimal)it.Hj_mn,
                    //Alloy_manganese_out = (decimal)it.Hj_mn_ck,
                    //Alloy_manganese_stock = (decimal)it.Hj_mn_kc,
                    //Taste9985 = (decimal)it.Pw_9985,
                    //Taste9980 = (decimal)it.Pw_9980,
                    //Taste9970 = (decimal)it.Pw_9970,
                    //Taste9970_below = (decimal)it.Pw_low9970,
                    //Aluminium_product_total = (int)it.Cp_sum,
                    //Product_total_out = (int)it.Cp_sum_ck,
                    //Product_total_stock = (int)it.Cp_sum_kc,
                    Is_used = it.IsUsed,
                };
                if (it.Ly_dj.HasValue) nIt.Liquid_aluminium = (decimal)it.Ly_dj;
                if (it.Ly_wx.HasValue) nIt.Export_aluminium = (decimal)it.Ly_wx;
                if (it.Ly_zz.HasValue) nIt.Casting_aluminium = (decimal)it.Ly_zz;
                if (it.Cp_zz.HasValue) nIt.Casting_aluminium_product = (int)it.Cp_zz;
                if (it.Cp_dx.HasValue) nIt.Directional_aluminium_product = (int)it.Cp_dx;
                if (it.Cp_ck.HasValue) nIt.Aluminium_product_out = (int)it.Cp_ck;
                if (it.Cp_kc.HasValue) nIt.Aluminium_product_stock = (int)it.Cp_kc;
                if (it.Hj_gi.HasValue) nIt.Alloy_silicon = (decimal)it.Hj_gi;
                if (it.Hj_gi_ck.HasValue) nIt.Alloy_silicon_out = (decimal)it.Hj_gi_ck;
                if (it.Hj_gi_kc.HasValue) nIt.Alloy_silicon_stock = (decimal)it.Hj_gi_kc;
                if (it.Hj_mn.HasValue) nIt.Alloy_manganese = (decimal)it.Hj_mn;
                if (it.Hj_mn_ck.HasValue) nIt.Alloy_manganese_out = (decimal)it.Hj_mn_ck;
                if (it.Hj_mn_kc.HasValue) nIt.Alloy_manganese_stock = (decimal)it.Hj_mn_kc;
                if (it.Pw_9985.HasValue) nIt.Taste9985 = (decimal)it.Pw_9985;
                if (it.Pw_9980.HasValue) nIt.Taste9980 = (decimal)it.Pw_9980;
                if (it.Pw_9970.HasValue) nIt.Taste9970 = (decimal)it.Pw_9970;
                if (it.Pw_low9970.HasValue) nIt.Taste9970_below = (decimal)it.Pw_low9970;
                if (it.Cp_sum.HasValue) nIt.Aluminium_product_total = (int)it.Cp_sum;
                if (it.Cp_sum_ck.HasValue) nIt.Product_total_out = (int)it.Cp_sum_ck;
                if (it.Cp_sum_kc.HasValue) nIt.Product_total_stock = (int)it.Cp_sum_kc;
                result.Add(nIt);
            }
            return result;
        }

        /// <summary>
        /// 将老生产调度日志表转换为新生产调度日志表
        /// </summary>
        internal static List<Ppd_dispatch_logInfo> ConvertDispatchLogInfoEntity(List<Pos_DispatchLogInfo> list)
        {
            List<Ppd_dispatch_logInfo> result = new List<Ppd_dispatch_logInfo>();
            if (list.Count == 0) { return result; }
            // 遍历老生产调度日志表
            foreach (var it in list)
            {
                Ppd_dispatch_logInfo nIt = new Ppd_dispatch_logInfo
                {
                    Id = Convert.ToInt64(it.Id),
                    Log_content = it.MainJob,
                    Left_over_job = it.LeftOverJob,
                    Require_coordination = it.RequireCoordination,
                    Rewards_punishment = it.RewardsPunishment,
                    Is_used = it.IsUsed,
                };
                result.Add(nIt);
            }
            return result;
        }

        /// <summary>
        /// 将老设备状态表转换为新设备状态表
        /// </summary>
        internal static List<Ppd_main_eq_stateInfo> ConvertEqStateInfoEntity(List<Pos_MainEQStateInfo> list)
        {
            List<Ppd_main_eq_stateInfo> result = new List<Ppd_main_eq_stateInfo>();
            if (list.Count == 0) { return result; }
            // 遍历老设备状态表
            foreach (var it in list)
            {
                Ppd_main_eq_stateInfo nIt = new Ppd_main_eq_stateInfo
                {
                    Id = Convert.ToInt64(it.Id),
                    Year = it.Year,
                    Month = it.Month,
                    Day = it.Day,
                    System_name = it.SystemName,
                    Eq_name = it.EquipmentName,
                    Unit = it.Unit,
                    Eq_num = it.Num,
                    Run_num = it.RunNum,
                    Stop_num = it.StopNum,
                    Overhaul_num = it.Stop_DX,
                    Plan_overhaul_num = it.Stop_JDX,
                    Spare_num = it.Stop_BY,
                    Is_used = it.IsUsed,
                };
                result.Add(nIt);
            }
            return result;
        }

        /// <summary>
        /// 将老生产物料日均消耗表转换为新生产物料日均消耗表
        /// </summary>
        internal static List<Ppd_material_avgInfo> ConvertMaterialAvgInfoEntity(List<Pos_MaterialAvgInfo> list)
        {
            List<Ppd_material_avgInfo> result = new List<Ppd_material_avgInfo>();
            if (list.Count == 0) { return result; }
            // 遍历老生产物料日均消耗表
            foreach (var it in list)
            {
                Ppd_material_avgInfo nIt = new Ppd_material_avgInfo
                {
                    Id = Convert.ToInt64(it.Id),
                    Year = it.Year,
                    Month = it.Month,
                    Day = it.Day,
                    //Alumina_avg = (decimal)it.Xh_yhl_avg,
                    //Cryolite_avg = (decimal)it.Xh_fhl_avg,
                    //Carbon240_avg = (decimal)it.Xh_tk240_avg,
                    //Carbon420_avg = (decimal)it.Xh_tk420_avg,
                    //Al_f3_avg = (decimal)it.Xh_bjs_avg,
                    Is_used = it.IsUsed,
                };
                if (it.Xh_yhl_avg.HasValue) nIt.Alumina_avg = (decimal)it.Xh_yhl_avg;
                if (it.Xh_fhl_avg.HasValue) nIt.Cryolite_avg = (decimal)it.Xh_fhl_avg;
                if (it.Xh_tk240_avg.HasValue) nIt.Carbon240_avg = (decimal)it.Xh_tk240_avg;
                if (it.Xh_tk420_avg.HasValue) nIt.Carbon420_avg = (decimal)it.Xh_tk420_avg;
                if (it.Xh_bjs_avg.HasValue) nIt.Al_f3_avg = (decimal)it.Xh_bjs_avg;
                result.Add(nIt);
            }
            return result;
        }

        /// <summary>
        /// 将老生产指标计划表转换为新生产指标计划表
        /// </summary>
        internal static List<Ppd_plan_parameterInfo> ConvertPlanParameterInfoEntity(List<Pos_Plan_ParamterInfo> list)
        {
            List<Ppd_plan_parameterInfo> result = new List<Ppd_plan_parameterInfo>();
            if (list.Count == 0) { return result; }
            // 遍历老生产指标计划表
            foreach (var it in list)
            {
                Ppd_plan_parameterInfo nIt = new Ppd_plan_parameterInfo
                {
                    //Id = Convert.ToInt64(it.Id),
                    Year = it.Year,
                    Month = it.Month,
                    //Voltage_avg = (decimal)it.Cs_pjdy1,
                    //Voltage_avg2 = (decimal)it.Cs_pjdy2,
                    //Coefficient = (decimal)it.Cs_xyxs1,
                    //Coefficient2 = (decimal)it.Cs_xyxs2,
                    //Current_efficiency = (decimal)it.Cs_dlxl1,
                    //Current_efficiency2 = (decimal)it.Cs_dlxl2,
                    //Dc_power_consumption = (decimal)it.Cs_zldh1,
                    //Dc_power_consumption2 = (decimal)it.Cs_zldh2,
                    Is_actioned = it.IsActioned,
                };
                if (it.Cs_pjdy1.HasValue) nIt.Voltage_avg = (decimal)it.Cs_pjdy1;
                if (it.Cs_pjdy2.HasValue) nIt.Voltage_avg2 = (decimal)it.Cs_pjdy2;
                if (it.Cs_xyxs1.HasValue) nIt.Coefficient = (decimal)it.Cs_xyxs1;
                if (it.Cs_xyxs2.HasValue) nIt.Coefficient2 = (decimal)it.Cs_xyxs2;
                if (it.Cs_dlxl1.HasValue) nIt.Current_efficiency = (decimal)it.Cs_dlxl1;
                if (it.Cs_dlxl2.HasValue) nIt.Current_efficiency2 = (decimal)it.Cs_dlxl2;
                if (it.Cs_zldh1.HasValue) nIt.Dc_power_consumption = (decimal)it.Cs_zldh1;
                if (it.Cs_zldh2.HasValue) nIt.Dc_power_consumption2 = (decimal)it.Cs_zldh2;
                result.Add(nIt);
            }
            return result;
        }

        /// <summary>
        /// 将老库存预警计划表转换为新库存预警计划表
        /// </summary>
        internal static List<Ppd_plan_stockInfo> ConvertPlanStockInfoEntity(List<Pos_Plan_StockInfo> list)
        {
            List<Ppd_plan_stockInfo> result = new List<Ppd_plan_stockInfo>();
            if (list.Count == 0) { return result; }
            // 遍历老库存预警计划表
            foreach (var it in list)
            {
                Ppd_plan_stockInfo nIt = new Ppd_plan_stockInfo
                {
                    //Id = Convert.ToInt64(it.Id),
                    Year = it.Year,
                    Month = it.Month,
                    //Alumina_stock = (decimal)it.Kc_yhl_aq,
                    //Alumina_compress_stock = (decimal)it.Kc_yhl_ys,
                    //Al_f3_stock = (decimal)it.Kc_fhl_aq,
                    //Al_f3_compress_stock = (decimal)it.Kc_fhl_ys,
                    //Cryolite_stock = (decimal)it.Kc_bjs_aq,
                    //Cryolite_compress_stock = (decimal)it.Kc_bjs_ys,
                    //Carbon240_stock = (decimal)it.Kc_240yjtk_aq,
                    //Carbon240_compress_stock = (decimal)it.Kc_240yjtk_ys,
                    //Carbon420_stock = (decimal)it.Kc_420yjtk_aq,
                    //Carbon420_compress_stock = (decimal)it.Kc_420yjtk_ys,
                    Is_actioned = it.IsActioned,
                };
                if (it.Kc_yhl_aq.HasValue) nIt.Alumina_stock = (decimal)it.Kc_yhl_aq;
                if (it.Kc_yhl_ys.HasValue) nIt.Alumina_compress_stock = (decimal)it.Kc_yhl_ys;
                if (it.Kc_fhl_aq.HasValue) nIt.Al_f3_stock = (decimal)it.Kc_fhl_aq;
                if (it.Kc_fhl_ys.HasValue) nIt.Al_f3_compress_stock = (decimal)it.Kc_fhl_ys;
                if (it.Kc_bjs_aq.HasValue) nIt.Cryolite_stock = (decimal)it.Kc_bjs_aq;
                if (it.Kc_bjs_ys.HasValue) nIt.Cryolite_compress_stock = (decimal)it.Kc_bjs_ys;
                if (it.Kc_240yjtk_aq.HasValue) nIt.Carbon240_stock = (decimal)it.Kc_240yjtk_aq;
                if (it.Kc_240yjtk_ys.HasValue) nIt.Carbon240_compress_stock = (decimal)it.Kc_240yjtk_ys;
                if (it.Kc_420yjtk_aq.HasValue) nIt.Carbon420_stock = (decimal)it.Kc_420yjtk_aq;
                if (it.Kc_420yjtk_ys.HasValue) nIt.Carbon420_compress_stock = (decimal)it.Kc_420yjtk_ys;
                result.Add(nIt);
            }
            return result;
        }

        /// <summary>
        /// 将老生产产量计划表转换为新生产产量计划表
        /// </summary>
        internal static List<Ppd_plan_yieldInfo> ConvertPlanYieldInfoEntity(List<Pos_Plan_YieldInfo> list)
        {
            List<Ppd_plan_yieldInfo> result = new List<Ppd_plan_yieldInfo>();
            if (list.Count == 0) { return result; }
            // 遍历老生产产量计划表
            foreach (var it in list)
            {
                Ppd_plan_yieldInfo nIt = new Ppd_plan_yieldInfo
                {
                    //Id = Convert.ToInt64(it.Id),
                    Year = it.Year,
                    Month = it.Month,
                    //Electrolysis_yield1 = (decimal)it.Cl_dj1,
                    //Electrolysis_yield2 = (decimal)it.Cl_dj2,
                    //Electrolysis_yield3 = (decimal)it.Cl_dj3,
                    //Electrolysis_yield4 = (decimal)it.Cl_dj4,
                    //Electrolysis_avg1 = (decimal)it.Day_avg_dj1,
                    //Electrolysis_avg2 = (decimal)it.Day_avg_dj2,
                    //Electrolysis_avg3 = (decimal)it.Day_avg_dj3,
                    //Electrolysis_avg4 = (decimal)it.Day_avg_dj4,
                    Is_actioned = it.IsActioned,
                };
                if (it.Cl_dj1.HasValue) nIt.Electrolysis_yield1 = (decimal)it.Cl_dj1;
                if (it.Cl_dj2.HasValue) nIt.Electrolysis_yield2 = (decimal)it.Cl_dj2;
                if (it.Cl_dj3.HasValue) nIt.Electrolysis_yield3 = (decimal)it.Cl_dj3;
                if (it.Cl_dj4.HasValue) nIt.Electrolysis_yield4 = (decimal)it.Cl_dj4;
                if (it.Day_avg_dj1.HasValue) nIt.Electrolysis_avg1 = (decimal)it.Day_avg_dj1;
                if (it.Day_avg_dj2.HasValue) nIt.Electrolysis_avg2 = (decimal)it.Day_avg_dj2;
                if (it.Day_avg_dj3.HasValue) nIt.Electrolysis_avg3 = (decimal)it.Day_avg_dj3;
                if (it.Day_avg_dj4.HasValue) nIt.Electrolysis_avg4 = (decimal)it.Day_avg_dj4;
                result.Add(nIt);
            }
            return result;
        }

        /// <summary>
        /// 将老生产10kV用电表转换为新生产10kV用电表
        /// </summary>
        internal static List<Ppd_power_10kvInfo> ConvertPower10kvEntity(List<Pos_Power10kVInfo> list)
        {
            List<Ppd_power_10kvInfo> result = new List<Ppd_power_10kvInfo>();
            if (list.Count == 0) { return result; }
            // 遍历老生产10kV用电表
            foreach (var it in list)
            {
                Ppd_power_10kvInfo nIt = new Ppd_power_10kvInfo
                {
                    Id = Convert.ToInt64(it.Id),
                    Year = it.Year,
                    Month = it.Month,
                    Day = it.Day,
                    //Electrolysis1 = (decimal)it.Dj1,
                    //High1 = (decimal)it.Gp1,
                    //Air_compressor_station1 = (decimal)it.Kyz1,
                    //Air_compressor1 = (decimal)it.Kyj1,
                    //Casting1 = (decimal)it.Zz1,
                    //Qingfeng = (decimal)it.Qf,
                    //Sewage = (decimal)it.Wsb,
                    //Assay = (decimal)it.Hyb,
                    //Casting = (decimal)it.Zzb,
                    //Electrolysis2 = (decimal)it.Dj2,
                    //High2 = (decimal)it.Gp2,
                    //Construction = (decimal)it.Sgdy,
                    //Air_compressor_station2 = (decimal)it.Kyz2,
                    //Air_compressor2 = (decimal)it.Kyj2,
                    //Factory = (decimal)it.Cqb,
                    //Anode = (decimal)it.Yj,
                    //Medium_frequency = (decimal)it.Zpl,
                    //Casting2 = (decimal)it.Zz2,
                    //Overhaul = (decimal)it.Cdx,
                    Is_used = it.IsUsed,
                };
                if (it.Dj1.HasValue) nIt.Electrolysis1 = (decimal)it.Dj1;
                if (it.Gp1.HasValue) nIt.High1 = (decimal)it.Gp1;
                if (it.Kyz1.HasValue) nIt.Air_compressor_station1 = (decimal)it.Kyz1;
                if (it.Kyj1.HasValue) nIt.Air_compressor1 = (decimal)it.Kyj1;
                if (it.Zz1.HasValue) nIt.Casting1 = (decimal)it.Zz1;
                if (it.Qf.HasValue) nIt.Qingfeng = (decimal)it.Qf;
                if (it.Wsb.HasValue) nIt.Sewage = (decimal)it.Wsb;
                if (it.Hyb.HasValue) nIt.Assay = (decimal)it.Hyb;
                if (it.Zzb.HasValue) nIt.Casting = (decimal)it.Zzb;
                if (it.Dj2.HasValue) nIt.Electrolysis2 = (decimal)it.Dj2;
                if (it.Gp2.HasValue) nIt.High2 = (decimal)it.Gp2;
                if (it.Sgdy.HasValue) nIt.Construction = (decimal)it.Sgdy;
                if (it.Kyz2.HasValue) nIt.Air_compressor_station2 = (decimal)it.Kyz2;
                if (it.Kyj2.HasValue) nIt.Air_compressor2 = (decimal)it.Kyj2;
                if (it.Cqb.HasValue) nIt.Factory = (decimal)it.Cqb;
                if (it.Yj.HasValue) nIt.Anode = (decimal)it.Yj;
                if (it.Zpl.HasValue) nIt.Medium_frequency = (decimal)it.Zpl;
                if (it.Zz2.HasValue) nIt.Casting2 = (decimal)it.Zz2;
                if (it.Cdx.HasValue) nIt.Overhaul = (decimal)it.Cdx;
                result.Add(nIt);
            }
            return result;
        }

        /// <summary>
        /// 将老动力用电表转换为新动力用电表
        /// </summary>
        internal static List<Ppd_powerInfo> ConvertPowerInfoEntity(List<Pos_PowerInfo> list)
        {
            List<Ppd_powerInfo> result = new List<Ppd_powerInfo>();
            if (list.Count == 0) { return result; }
            // 遍历老动力用电表
            foreach (var it in list)
            {
                Ppd_powerInfo nIt = new Ppd_powerInfo
                {
                    Id = Convert.ToInt64(it.Id),
                    Year = it.Year,
                    Month = it.Month,
                    Day = it.Day,
                    //Power = (decimal)it.Dl_qt,
                    //Electrolysis_ac_power = (decimal)it.Dl_djjl,
                    //Electrolysis_dc_power = (decimal)it.Dl_djzl,
                    //Power_power = (decimal)it.Dl_dl,
                    //Load_avg = (decimal)it.Pjfh,
                    //Power_factor = (decimal)it.Glys,
                    //Voltage1 = (decimal)it.Xldy1,
                    //Ac_power1 = (decimal)it.Jldl1,
                    //Dc_power1 = (decimal)it.Zldl1,
                    //Rectifier_efficiency1 = (decimal)it.Zlxl1,
                    //Load_rate1 = (decimal)it.Fhl1,
                    //Voltage2 = (decimal)it.Xldy2,
                    //Ac_power2 = (decimal)it.Jldl2,
                    //Dc_power2 = (decimal)it.Zldl2,
                    //Rectifier_efficiency2 = (decimal)it.Zlxl2,
                    //Load_rate2 = (decimal)it.Fhl2,
                    Is_used = it.IsUsed,
                };
                if (it.Dl_qt.HasValue) nIt.Power = (decimal)it.Dl_qt;
                if (it.Dl_djjl.HasValue) nIt.Electrolysis_ac_power = (decimal)it.Dl_djjl;
                if (it.Dl_djzl.HasValue) nIt.Electrolysis_dc_power = (decimal)it.Dl_djzl;
                if (it.Dl_dl.HasValue) nIt.Power_power = (decimal)it.Dl_dl;
                if (it.Pjfh.HasValue) nIt.Load_avg = (decimal)it.Pjfh;
                if (it.Glys.HasValue) nIt.Power_factor = (decimal)it.Glys;
                if (it.Xldy1.HasValue) nIt.Voltage1 = (decimal)it.Xldy1;
                if (it.Jldl1.HasValue) nIt.Ac_power1 = (decimal)it.Jldl1;
                if (it.Zldl1.HasValue) nIt.Dc_power1 = (decimal)it.Zldl1;
                if (it.Zlxl1.HasValue) nIt.Rectifier_efficiency1 = (decimal)it.Zlxl1;
                if (it.Fhl1.HasValue) nIt.Load_rate1 = (decimal)it.Fhl1;
                if (it.Xldy2.HasValue) nIt.Voltage2 = (decimal)it.Xldy2;
                if (it.Jldl2.HasValue) nIt.Ac_power2 = (decimal)it.Jldl2;
                if (it.Zldl2.HasValue) nIt.Dc_power2 = (decimal)it.Zldl2;
                if (it.Zlxl2.HasValue) nIt.Rectifier_efficiency2 = (decimal)it.Zlxl2;
                if (it.Fhl2.HasValue) nIt.Load_rate2 = (decimal)it.Fhl2;
                result.Add(nIt);
            }
            return result;
        }

        /// <summary>
        /// 将老电解产量表转换为新电解产量表
        /// </summary>
        internal static List<Ppd_product_djInfo> ConvertProductDJInfoEntity(List<Pos_ProductDJInfo> list)
        {
            List<Ppd_product_djInfo> result = new List<Ppd_product_djInfo>();
            if (list.Count == 0) { return result; }
            // 遍历老电解产量表
            foreach (var it in list)
            {
                Ppd_product_djInfo nIt = new Ppd_product_djInfo
                {
                    Id = Convert.ToInt64(it.Id),
                    Year = it.Year,
                    Month = it.Month,
                    Day = it.Day,
                    //Electrolysis1 = (decimal)it.Cl1,
                    //Electrolysis2 = (decimal)it.Cl2,
                    //Electrolysis3 = (decimal)it.Cl3,
                    //Electrolysis4 = (decimal)it.Cl4,
                    Is_used = it.IsUsed,
                };
                if (it.Cl1.HasValue) nIt.Electrolysis1 = (decimal)it.Cl1;
                if (it.Cl2.HasValue) nIt.Electrolysis2 = (decimal)it.Cl2;
                if (it.Cl3.HasValue) nIt.Electrolysis3 = (decimal)it.Cl3;
                if (it.Cl4.HasValue) nIt.Electrolysis4 = (decimal)it.Cl4;
                result.Add(nIt);
            }
            return result;
        }

        /// <summary>
        /// 将老电解生产参数统计表转换为新电解生产参数统计表
        /// </summary>
        internal static List<Ppd_product_paramInfo> ConvertProductParamInfoEntity(List<Pos_ProductParamInfo> list)
        {
            List<Ppd_product_paramInfo> result = new List<Ppd_product_paramInfo>();
            if (list.Count == 0) { return result; }
            // 遍历老电解生产参数统计表
            foreach (var it in list)
            {
                Ppd_product_paramInfo nIt = new Ppd_product_paramInfo
                {
                    Id = Convert.ToInt64(it.Id),
                    Year = it.Year,
                    Month = it.Month,
                    Day = it.Day,
                    Workshop = it.Chj,
                    //Al_f3 = (decimal)it.Fhlyl,
                    //Al_f3_actual = (decimal)it.Xh_fhl,
                    //Effect_times = it.Xycs,
                    //Production_slots = it.Sccs,
                    //Roasting_slots = it.Bscs,
                    //Stop_slots = (decimal)it.Tcs,
                    //Current_intensity = (decimal)it.Dlqd,
                    //Voltage_avg = (decimal)it.Pjdy,
                    //Current_efficiency = (decimal)it.Dlxl,
                    //Coefficient = (decimal)it.Xyxs,
                    //Dc_power_consumption = (decimal)it.Zldh,
                    //Stop_dc_power_consumption = (decimal)it.Tczldh,
                    Is_used = it.IsUsed,
                };
                if (it.Fhlyl.HasValue) nIt.Al_f3 = (decimal)it.Fhlyl;
                if (it.Xh_fhl.HasValue) nIt.Al_f3_actual = (decimal)it.Xh_fhl;
                if (it.Xycs.HasValue) nIt.Effect_times = it.Xycs;
                if (it.Sccs.HasValue) nIt.Production_slots = it.Sccs;
                if (it.Bscs.HasValue) nIt.Roasting_slots = it.Bscs;
                if (it.Tcs.HasValue) nIt.Stop_slots = (decimal)it.Tcs;
                if (it.Dlqd.HasValue) nIt.Current_intensity = (decimal)it.Dlqd;
                if (it.Pjdy.HasValue) nIt.Voltage_avg = (decimal)it.Pjdy;
                if (it.Dlxl.HasValue) nIt.Current_efficiency = (decimal)it.Dlxl;
                if (it.Xyxs.HasValue) nIt.Coefficient = (decimal)it.Xyxs;
                if (it.Zldh.HasValue) nIt.Dc_power_consumption = (decimal)it.Zldh;
                if (it.Tczldh.HasValue) nIt.Stop_dc_power_consumption = (decimal)it.Tczldh;
                result.Add(nIt);
            }
            return result;
        }

        /// <summary>
        /// 将老质量抽检表转换为新质量抽检表
        /// </summary>
        internal static List<Ppd_quality_testInfo> ConvertQualityTestInfoEntity(List<Pos_QualityTestInfo> list)
        {
            List<Ppd_quality_testInfo> result = new List<Ppd_quality_testInfo>();
            if (list.Count == 0) { return result; }
            // 遍历老质量抽检表
            foreach (var it in list)
            {
                Ppd_quality_testInfo nIt = new Ppd_quality_testInfo
                {
                    Id = Convert.ToInt64(it.Id),
                    Year = it.Year,
                    Month = it.Month,
                    Day = it.Day,
                    Al2o3_date = it.Yhl_qy_date,
                    Al2o3_count = it.Yhl_qy_count,
                    Al2o3_level1 = it.Yhl_zl1,
                    Al2o3_level2 = it.Yhl_zl2,
                    //Al2o3_level1_rate = (decimal)it.Yhl_hgl1,
                    //Al2o3_level2_rate = (decimal)it.Yhl_hgl2,
                    Anode_date = it.Yjtk_qy_date,
                    Anode_count = it.Yjtk_qy_count,
                    Anode_level1 = it.Yjtk_zl1,
                    Anode_level2 = it.Yjtk_zl2,
                    //Anode_level1_rate = (decimal)it.Yjtk_hgl1,
                    //Anode_level2_rate = (decimal)it.Yjtk_hgl2,
                    Al_f3_date = it.Fhl_qy_date,
                    Al_f3_count = it.Fhl_qy_count,
                    Al_f3_level1 = it.Fhl_zl1,
                    Al_f3_level2 = it.Fhl_zl2,
                    //Al_f3_level1_rate = (decimal)it.Fhl_hgl1,
                    //Al_f3_level2_rate = (decimal)it.Fhl_hgl2,
                    Cryolite_date = it.Bjs_qy_date,
                    Cryolite_count = it.Bjs_qy_count,
                    Cryolite_level1 = it.Bjs_zl1,
                    Cryolite_level2 = it.Bjs_zl2,
                    //Cryolite_level1_rate = (decimal)it.Bjs_hgl1,
                    //Cryolite_level2_rate = (decimal)it.Bjs_hgl2,
                    Is_used = it.IsUsed,
                };
                if (it.Yhl_hgl1.HasValue) nIt.Al2o3_level1_rate = (decimal)it.Yhl_hgl1;
                if (it.Yhl_hgl2.HasValue) nIt.Al2o3_level2_rate = (decimal)it.Yhl_hgl2;
                if (it.Yjtk_hgl1.HasValue) nIt.Anode_level1_rate = (decimal)it.Yjtk_hgl1;
                if (it.Yjtk_hgl2.HasValue) nIt.Anode_level2_rate = (decimal)it.Yjtk_hgl2;
                if (it.Fhl_hgl1.HasValue) nIt.Al_f3_level1_rate = (decimal)it.Fhl_hgl1;
                if (it.Fhl_hgl2.HasValue) nIt.Al_f3_level2_rate = (decimal)it.Fhl_hgl2;
                if (it.Bjs_hgl1.HasValue) nIt.Cryolite_level1_rate = (decimal)it.Bjs_hgl1;
                if (it.Bjs_hgl2.HasValue) nIt.Cryolite_level2_rate = (decimal)it.Bjs_hgl2;
                result.Add(nIt);
            }
            return result;
        }

        /// <summary>
        /// 将老氧化铝生产用量及库存表转换为新氧化铝生产用量及库存表
        /// </summary>
        internal static List<Ppd_stock_aluminaInfo> ConvertStockYHLInfoEntity(List<Pos_Stock_YHLInfo> list)
        {
            List<Ppd_stock_aluminaInfo> result = new List<Ppd_stock_aluminaInfo>();
            if (list.Count == 0) { return result; }
            // 遍历老氧化铝生产用量及库存表
            foreach (var it in list)
            {
                Ppd_stock_aluminaInfo nIt = new Ppd_stock_aluminaInfo
                {
                    Id = Convert.ToInt64(it.Id),
                    Year = it.Year,
                    Month = it.Month,
                    Day = it.Day,
                    //Al2o3_fresh1 = (decimal)it.Kc_preday_xxc1,
                    //Al2o3_fresh2 = (decimal)it.Kc_preday_xxc2,
                    //Al2o3_carry1 = (decimal)it.Kc_preday_zfc1,
                    //Al2o3_carry2 = (decimal)it.Kc_preday_zfc2,
                    //Al2o3_fresh1_today = (decimal)it.Kc_today_xxc1,
                    //Al2o3_fresh2_today = (decimal)it.Kc_today_xxc2,
                    //Al2o3_fresh_total_today = (decimal)it.Kc_today_xxc_sum,
                    //Al2o3_carry1_today = (decimal)it.Kc_today_zfc1,
                    //Al2o3_carry2_today = (decimal)it.Kc_today_zfc2,
                    //Feed1_today = (decimal)it.Dl_today1,
                    //Feed2_today = (decimal)it.Dl_today2,
                    //Feed_total_today = (decimal)it.Dl_today_sum,
                    //Al2o3_consume1_today = (decimal)it.Xh_today1,
                    //Al2o3_consume2_today = (decimal)it.Xh_today2,
                    //Al2o3_consume_total_today = (decimal)it.Xh_today_sum,
                    Is_used = it.IsUsed,
                };
                if (it.Kc_preday_xxc1.HasValue) nIt.Al2o3_fresh1 = (decimal)it.Kc_preday_xxc1;
                if (it.Kc_preday_xxc2.HasValue) nIt.Al2o3_fresh2 = (decimal)it.Kc_preday_xxc2;
                if (it.Kc_preday_zfc1.HasValue) nIt.Al2o3_carry1 = (decimal)it.Kc_preday_zfc1;
                if (it.Kc_preday_zfc2.HasValue) nIt.Al2o3_carry2 = (decimal)it.Kc_preday_zfc2;
                if (it.Kc_today_xxc1.HasValue) nIt.Al2o3_fresh1_today = (decimal)it.Kc_today_xxc1;
                if (it.Kc_today_xxc2.HasValue) nIt.Al2o3_fresh2_today = (decimal)it.Kc_today_xxc2;
                if (it.Kc_today_xxc_sum.HasValue) nIt.Al2o3_fresh_total_today = (decimal)it.Kc_today_xxc_sum;
                if (it.Kc_today_zfc1.HasValue) nIt.Al2o3_carry1_today = (decimal)it.Kc_today_zfc1;
                if (it.Kc_today_zfc2.HasValue) nIt.Al2o3_carry2_today = (decimal)it.Kc_today_zfc2;
                if (it.Dl_today1.HasValue) nIt.Feed1_today = (decimal)it.Dl_today1;
                if (it.Dl_today2.HasValue) nIt.Feed2_today = (decimal)it.Dl_today2;
                if (it.Dl_today_sum.HasValue) nIt.Feed_total_today = (decimal)it.Dl_today_sum;
                if (it.Xh_today1.HasValue) nIt.Al2o3_consume1_today = (decimal)it.Xh_today1;
                if (it.Xh_today2.HasValue) nIt.Al2o3_consume2_today = (decimal)it.Xh_today2;
                if (it.Xh_today_sum.HasValue) nIt.Al2o3_consume_total_today = (decimal)it.Xh_today_sum;
                result.Add(nIt);
            }
            return result;
        }

        /// <summary>
        /// 将老阳极库存表转换为新阳极库存表
        /// </summary>
        internal static List<Ppd_stock_anode_carbonInfo> ConvertStockAnodeCarbonInfoEntity(List<Pos_Stock_YJTKInfo> list)
        {
            List<Ppd_stock_anode_carbonInfo> result = new List<Ppd_stock_anode_carbonInfo>();
            if (list.Count == 0) { return result; }
            // 遍历老阳极库存表
            foreach (var it in list)
            {
                Ppd_stock_anode_carbonInfo nIt = new Ppd_stock_anode_carbonInfo
                {
                    Id = Convert.ToInt64(it.Id),
                    Year = it.Year,
                    Month = it.Month,
                    Day = it.Day,
                    Anode1 = it.Kc_preday_yjk1,
                    Anode2 = it.Kc_preday_yjk2,
                    Carbon1 = it.Kc_preday_tkk1,
                    Carbon2 = it.Kc_preday_tkk2,
                    Carbon1_in = it.Rk_today_tk1,
                    Carbon2_in = it.Rk_today_tk2,
                    Casting1 = it.Cl_today_zzjzl1,
                    Casting2 = it.Cl_today_zzjzl2,
                    Anode1_today = it.Kc_today_yjk1,
                    Anode2_today = it.Kc_today_yjk2,
                    Carbon1_today = it.Kc_today_tkk1,
                    Carbon2_today = it.Kc_today_tkk2,
                    Anode1_production = it.Kc_scyj1,
                    Anode2_production = it.Kc_scyj2,
                    Anode1_electrolysis = it.Xh_dj1,
                    Anode2_electrolysis = it.Xh_dj2,
                    Is_used = it.IsUsed,
                };
                result.Add(nIt);
            }
            return result;
        }

        /// <summary>
        /// 将老电解物料库存表转换为新电解物料库存表
        /// </summary>
        internal static List<Ppd_stock_djInfo> ConvertStockDJInfoEntity(List<Pos_StockDJInfo> list)
        {
            List<Ppd_stock_djInfo> result = new List<Ppd_stock_djInfo>();
            if (list.Count == 0) { return result; }
            // 遍历老电解物料库存表
            foreach (var it in list)
            {
                Ppd_stock_djInfo nIt = new Ppd_stock_djInfo
                {
                    Id = Convert.ToInt64(it.Id),
                    Year = it.Year,
                    Month = it.Month,
                    Day = it.Day,
                    //Cryolite1 = (decimal)it.Bjs1,
                    //Cryolite2 = (decimal)it.Bjs2,
                    //Cryolite3 = (decimal)it.Bjs3,
                    //Cryolite4 = (decimal)it.Bjs4,
                    //Cryolite_total = (decimal)it.Bjs_sum,
                    //Al_f3_inventory1 = (decimal)it.Fhl1,
                    //Al_f3_inventory2 = (decimal)it.Fhl2,
                    //Al_f3_inventory3 = (decimal)it.Fhl3,
                    //Al_f3_inventory4 = (decimal)it.Fhl4,
                    //Al_f3_total = (decimal)it.Fhl_sum,
                    Is_used = it.IsUsed,
                };
                if (it.Bjs1.HasValue) nIt.Cryolite1 = (decimal)it.Bjs1;
                if (it.Bjs2.HasValue) nIt.Cryolite2 = (decimal)it.Bjs2;
                if (it.Bjs3.HasValue) nIt.Cryolite3 = (decimal)it.Bjs3;
                if (it.Bjs4.HasValue) nIt.Cryolite4 = (decimal)it.Bjs4;
                if (it.Bjs_sum.HasValue) nIt.Cryolite_total = (decimal)it.Bjs_sum;
                if (it.Fhl1.HasValue) nIt.Al_f3_inventory1 = (decimal)it.Fhl1;
                if (it.Fhl2.HasValue) nIt.Al_f3_inventory2 = (decimal)it.Fhl2;
                if (it.Fhl3.HasValue) nIt.Al_f3_inventory3 = (decimal)it.Fhl3;
                if (it.Fhl4.HasValue) nIt.Al_f3_inventory4 = (decimal)it.Fhl4;
                if (it.Fhl_sum.HasValue) nIt.Al_f3_total = (decimal)it.Fhl_sum;
                result.Add(nIt);
            }
            return result;
        }

        /// <summary>
        /// 将老储运原材料出入库表转换为新储运原材料出入库表
        /// </summary>
        internal static List<Ppd_storage_transInfo> ConvertStorageMaterialInfoEntity(List<Pos_StorageTransInfo> list)
        {
            List<Ppd_storage_transInfo> result = new List<Ppd_storage_transInfo>();
            if (list.Count == 0) { return result; }
            // 遍历老储运原材料出入库表
            foreach (var it in list)
            {
                Ppd_storage_transInfo nIt = new Ppd_storage_transInfo
                {
                    Id = Convert.ToInt64(it.Id),
                    Year = it.Year,
                    Month = it.Month,
                    Day = it.Day,
                    //In_al = (decimal)it.Rk_ld,
                    //In_al2o3 = (decimal)it.Rk_yhl,
                    //In_cryolite = (decimal)it.Rk_bjs,
                    //In_al_f3 = (decimal)it.Rk_fhl,
                    //In_carbon240 = (decimal)it.Rk_tk240,
                    //In_carbon420 = (decimal)it.Rk_tk420,
                    //Out_al = (decimal)it.Ck_ld,
                    //Out_al2o3 = (decimal)it.Ck_yhl,
                    //Out_cryolite = (decimal)it.Ck_bjs,
                    //Out_al_f3 = (decimal)it.Ck_fhl,
                    //Out_carbon240 = (decimal)it.Ck_tk240,
                    //Out_carbon420 = (decimal)it.Ck_tk420,
                    //Stock_al = (decimal)it.Kc_ld,
                    //Stock_al2o3 = (decimal)it.Kc_yhl,
                    //Stock_cryolite = (decimal)it.Kc_bjs,
                    //Stock_al_f3 = (decimal)it.Kc_fhl,
                    //Stock_carbon240 = (decimal)it.Kc_tk240,
                    //Stock_carbon420 = (decimal)it.Kc_tk420,
                    Is_used = it.IsUsed,
                };
                if (it.Rk_ld.HasValue) nIt.In_al = (decimal)it.Rk_ld;
                if (it.Rk_yhl.HasValue) nIt.In_al2o3 = (decimal)it.Rk_yhl;
                if (it.Rk_bjs.HasValue) nIt.In_cryolite = (decimal)it.Rk_bjs;
                if (it.Rk_fhl.HasValue) nIt.In_al_f3 = (decimal)it.Rk_fhl;
                if (it.Rk_tk240.HasValue) nIt.In_carbon240 = (decimal)it.Rk_tk240;
                if (it.Rk_tk420.HasValue) nIt.In_carbon420 = (decimal)it.Rk_tk420;
                if (it.Ck_ld.HasValue) nIt.Out_al = (decimal)it.Ck_ld;
                if (it.Ck_yhl.HasValue) nIt.Out_al2o3 = (decimal)it.Ck_yhl;
                if (it.Ck_bjs.HasValue) nIt.Out_cryolite = (decimal)it.Ck_bjs;
                if (it.Ck_fhl.HasValue) nIt.Out_al_f3 = (decimal)it.Ck_fhl;
                if (it.Ck_tk240.HasValue) nIt.Out_carbon240 = (decimal)it.Ck_tk240;
                if (it.Ck_tk420.HasValue) nIt.Out_carbon420 = (decimal)it.Ck_tk420;
                if (it.Kc_ld.HasValue) nIt.Stock_al = (decimal)it.Kc_ld;
                if (it.Kc_yhl.HasValue) nIt.Stock_al2o3 = (decimal)it.Kc_yhl;
                if (it.Kc_bjs.HasValue) nIt.Stock_cryolite = (decimal)it.Kc_bjs;
                if (it.Kc_fhl.HasValue) nIt.Stock_al_f3 = (decimal)it.Kc_fhl;
                if (it.Kc_tk240.HasValue) nIt.Stock_carbon240 = (decimal)it.Kc_tk240;
                if (it.Kc_tk420.HasValue) nIt.Stock_carbon420 = (decimal)it.Kc_tk420;
                result.Add(nIt);
            }
            return result;
        }

        /// <summary>
        /// 将老电解产量表转换为新电解产量表
        /// </summary>
        internal static List<Ppd_yield_djInfo> ConvertYieldDjInfoEntity(List<Pos_YieldDJInfo> list)
        {
            List<Ppd_yield_djInfo> result = new List<Ppd_yield_djInfo>();
            if (list.Count == 0) { return result; }
            // 遍历老电解产量表
            foreach (var it in list)
            {
                Ppd_yield_djInfo nIt = new Ppd_yield_djInfo
                {
                    Id = Convert.ToInt64(it.Id),
                    Year = it.Year,
                    Month = it.Month,
                    Day = it.Day,
                    //Electrolysis1 = (decimal)it.Dj1,
                    //Electrolysis2 = (decimal)it.Dj2,
                    //Electrolysis3 = (decimal)it.Dj3,
                    //Electrolysis4 = (decimal)it.Dj4,
                    //Total = (decimal)it.Dj_sum,
                    Is_used = it.IsUsed,
                };
                if (it.Dj1.HasValue) nIt.Electrolysis1 = (decimal)it.Dj1;
                if (it.Dj2.HasValue) nIt.Electrolysis2 = (decimal)it.Dj2;
                if (it.Dj3.HasValue) nIt.Electrolysis3 = (decimal)it.Dj3;
                if (it.Dj4.HasValue) nIt.Electrolysis4 = (decimal)it.Dj4;
                if (it.Dj_sum.HasValue) nIt.Total = (decimal)it.Dj_sum;
                result.Add(nIt);
            }
            return result;
        }
    }
}